import Queue from './Queue';

class ArrayQueue<T> implements Queue<T> {
  private data: T[] = [];

  enqueue(element: T): void {
    this.data.push(element);
  }

  dequeue(): T | undefined {
    return this.data.shift();
  }

  peek(): T | undefined {
    return this.data[0];
  }

  isEmpty(): boolean {
    return this.data.length === 0;
  }

  get size(): number {
    return this.data.length;
  }
}

class LinkedQueue {}

const arr = new ArrayQueue<string>();
arr.enqueue('1');
arr.enqueue('2');
arr.enqueue('3');
console.log(arr.size);
console.log(arr.peek());
console.log(arr.isEmpty());
console.log(arr.dequeue());
console.log(arr.dequeue());
console.log(arr.dequeue());

export default ArrayQueue;
